package com.peanuts.tender.service.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.peanuts.tender.dao.TenderMapper;
import com.peanuts.tender.pojo.Tender;
import com.peanuts.tender.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by wangke on 2018/3/23.
 */
@Service
public class TestServiceImpl implements TestService{
@Autowired
private TenderMapper tenderMapper;
    @Override
    public String test() {
        return "123";
    }

    @Override
    public PageInfo<Tender> tenderList(String type,Integer pageIndex) {
        PageHelper.startPage(pageIndex, 10);
        List<Tender> tenders=tenderMapper.selectAll(type);
        return new PageInfo<Tender>(tenders);
    }

    @Override
    public PageInfo<Tender> keywordSearch(String keyword, Integer pageIndex) {
        PageHelper.startPage(pageIndex, 10);
        List<Tender> tenders=tenderMapper.keywordSearch(keyword);
        return new PageInfo<Tender>(tenders);
    }
}
